# -*- coding: utf8 -*-
from human import Player
from human import Enemy
from tmap import Map
from skill import Skill
from item import Item
from equipment import Equipment
import unittest
class TestState(unittest.TestCase):
    def test_state(self):
        pao=Player(mhp=617,hp=600,mov=2,atk=500,defend=150,exp=0,name='ボボ')        #玩家大包
        tan=Player(mhp=1000,hp=1000,mov=1,atk=300,defend=300,exp=0,name='谭胖子')   # 玩家谭胖子
        xu=Player(mhp=888,hp=888,mov=1,atk=480,defend=160,exp=80,name='Mr.FR')    #玩家芙蓉
        yan=Enemy(mhp=49820,hp=49820,mov=4,atk=500,defend=188,name='严如家')
        tmap=Map([[pao,tan,xu,0,0],              # 第0回合的地形图  p,t,f,0,0
                      [0,0,0,0,0],                         #                0,0,0,0,0          
                      [0,0,0,0,0],                         #                0,0,0,0,0
                      [0,0,0,0,0],                         #                0,0,0,0,0
                      [0,0,0,0,yan]])                 #                0,0,0,0,y
        tmap.missionStart()
        self.asserEqual(pao.curState(),UnableState)  #开始测试初始化状态，默认为不可行动
        self.assertEqual(yan.curState(),UnableState)
        tmap.mapRoundStart(flug='hero') #回合开始，所有英雄状态全开，可以正常行动
        self.assertEqual(pao.curState(),EnableState)
        self.assertEqual(tan.curState(),EnableState)
        tmap.fly(pao,1,0)
        self.assertEqual(pao.curState(),OperableState)
        tmap.fly(tan,1,1)
        self.assertEqal(tan.curState(),OperableState)
        tan.attack(pao,0)
        self.assertEqual(tan.curState(),UnableState)
        self.assertEqual(yan.curState(),UnableState)
        tmap.mapRoundStart(flug='enemy')
        self.assertEqual(pao.curState(),UnableState)
        self.assertEqual(tan.curState(),UnableState)
        self.assertEqual(yan.curState(),EnableState)